#ifndef DELEGATE_H
#define DELEGATE_H
#include <QItemDelegate>
#include <QSpinBox>
#include <QMessageBox>
#include <QLabel>


class Delegate : public  QItemDelegate
{
    Q_OBJECT

public:
    Delegate(QObject *parent = 0);

    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
                          const QModelIndex &index) const;

    void setEditorData(QWidget *editor, const QModelIndex &index) const;
    void setModelData(QWidget *editor, QAbstractItemModel *model,
                      const QModelIndex &index) const;

    void updateEditorGeometry(QWidget *editor,const QStyleOptionViewItem &option, const QModelIndex &index) const;
   // bool input_check(const QModelIndex &index,int value) const;
    void set_input_range(QSpinBox *spinBox,const QModelIndex &index) const;
    void set_datamap(QMap<QString,int>* datamap_ptr,uint checktype);
 private:
    uint checktype;
    QMap<QString,int>* datamap_ptr;
    QList<QString > keylist;
};

#endif // DELEGATE_H
